<template>
  <div class="whole">
      <!-- 头部 -->
    <div class="head">
      <i class="iconfont icon-fanhui back" @click="backHandler"></i>
      <span>动态详情</span>
    </div>
    <!-- 内容 -->
    <div v-if="listview.length>0" class="boxstyle">
      <div v-for="(item) in listview" :key="item.id" class="list">
        <router-link :to="{ }" href="#" >
          <UserTitle :icon="item.icon" :user="item.user" :time="item.time" :city="item.city"/>
        </router-link>
        <img :src="item.img" alt>
        <p class="text">{{item.desc}}</p>
      </div>
    </div>
    <div v-else>正在加载数据...</div>
  </div>
</template>

<script>
import UserTitle from "./UserTitle";
export default {
  name: "FitDetailListView",
  data() {
    return {};
  },
  components: {
    UserTitle
  },
  props: {
    listview: {
      type: Array,
      default: function() {
        return [];
      }
    }
  },
  methods: {
      backHandler(){
          window.history.back()
        }
  },
  mounted() {
    console.log(this.listview);
  }
};
</script>
<style scoped lang="less">

.whole{
    margin-top: 0;
}
.head{
    width:100%;
    background-color: #171818;
    height: 60px;
    line-height: 60px;
    color:white;
    text-align: center
}
.back{
    float: left;
    font-size: 1rem;
    margin-left: 10px
}
.boxstyle {
  overflow: auto;
  // width: 100%;
}
.list {
  background-color: white;
  margin-bottom: 10px;
  display: block;
  padding: 0 10px;
  .user {
    overflow: hidden;
    /* display: table-cell; */
    vertical-align: middle;
    padding: 5px 0;
    img {
      width: 2rem;
      float: left;

      position: relative;
      top: 0.2rem;
    }
    .center {
      float: left;
      margin-left: 0.5rem;
      p {
        font-size: 0.8rem;
      }
      span {
        font-size: 0.7rem;
        color: #a8a9a9;
      }
    }
    .time {
      float: right;
      font-size: 0.8rem;
      line-height: 2rem;
    }
  }
  img {
    width: 100%;
  }
  .text {
    font-size: 0.7rem;
    // margin-top: 10px;
    letter-spacing: 2px;
    line-height: 1.3rem;
    padding: 10px 0;
    border-bottom: 1px solid #dcdcdc;
  }
  ul {
    overflow: hidden;
    li {
      list-style: none;
      float: left;
      width: 49%;
      text-align: center;
      font-size: 0.7rem;
      margin: 10px 0;
    }
  }
}
.first {
  border-right: 1px solid #a8a9a9;
}
.second {
  float: right;
}
// 只能有一个class会覆盖之前的
.clear-padding {
  margin: 0;
  margin-top: 10px;
}
</style>